#define _CRT_SECURE_NO_WARNINGS   1

#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;

int main()
{
	int n;
	cin >> n;
	vector<int> arr(n);
	for (int i = 0; i<n; i++)
		cin >> arr[i];
	vector<int> dp(n, 1);

	for (int i = 1; i<n; i++)
	{
		int mx = 0;
		for (int j = 0; j<i; j++)
		{
			if (arr[i]>arr[j])
				mx = max(mx, dp[j]);
		}
		dp[i] = mx + 1;
	}
	int res = 1;
	for (int i = 0; i<n; i++)
		res = max(res, dp[i]);
	cout << res;
	return 0;
}
